<?php

	if(isset($_GET['i']) && isset($_GET['t']) && isset($_GET['p'])) {
		 $user = new User($_GET['i']);
		 if(Sponsorship::exist($user, $_GET['p'])) {
			 $_SESSION['sponsorship'] = new Sponsorship();
			 $_SESSION['sponsorship']['type'] = $_GET['t'];
			 $_SESSION['sponsorship']['sponsor'] = $user;
		 }
		 $url = explode("/", $_SERVER['REQUEST_URI']);
		 $url = array_slice($url, 0, sizeof($url)-1);
		 header('Location: '.implode($url, "/").'/');
	}
	
?>